export const DefaultEchartWidth = 300;
export const DefaultEchartHeight = 300;

export const JnpfCommandIds = {
  echartOperations: 'jnpf-sheets.operation.echart',
  insertedEchart: 'jnpf-sheets.operation.inserted-echart',
  insertBarEchart: 'jnpf-sheets.operation.insert-bar-echart',
  insertLineEchart: 'jnpf-sheets.operation.insert-line-echart',
  insertPieEchart: 'jnpf-sheets.operation.insert-pie-echart',
  insertRadarEchart: 'jnpf-sheets.operation.insert-radar-echart',
  focusEchart: 'jnpf-sheets.operation.focus-echart',

  excelFileOperations: 'jnpf-sheets.operation.excel-file',
  importExcelFile: 'jnpf-sheets.operation.import-excel-file',
  downloadExcelFile: 'jnpf-sheets.operation.download-excel-file',
  importCsvFile: 'jnpf-sheets.operation.import-csv-file',

  preview: 'jnpf-sheets.operation.preview',
  print: 'jnpf-sheets.operation.print',
};

export const JnpfUniverEchartKey = 'JnpfUniverEchart';

export const DefaultEchartOptions = {
  bar: {
    classifyNameField: undefined,
    seriesNameField: undefined,
    seriesDataField: undefined,
    summaryType: 'none',
    chartType: 'bar',
    animation: false,
    styleType: 1, //风格类型
    //标题设置
    title: {
      text: '柱状图示例',
      show: true,
      left: 'center',
      textStyle: { fontSize: 18, fontWeight: 'normal', color: '#333' },
      showSub: true,
      subtext: '子标题',
      subtextStyle: {
        fontSize: 12,
        fontWeight: 'normal',
        color: '#aaa',
      },
    },
    barWidth: 25, //宽度设置
    itemStyle: {
      borderRadius: 0, //弧度设置
    },
    //坐标轴边距设置
    grid: {
      left: 30,
      top: 60,
      right: 10,
      bottom: 50,
    },
    //提示语设置
    tooltip: {
      show: true,
      backgroundColor: '#fff',
      textStyle: {
        color: '#303133',
        fontSize: 14,
        fontWeight: '',
      },
    },
    //图例设置
    legend: {
      show: true,
      textStyle: {
        fontSize: 14,
      },
      fontSize: 14,
      orient: 'horizontal',
      top: 'bottom',
    },
    //数值设置
    label: {
      show: false, //显示数值
      fontSize: 14, //数值大小
      fontWeight: '', //数值加粗
      color: '#303133', //数值颜色
      backgroundColor: '', //数值背景色
      seriesLabelPosition: 'outside',
      seriesLabelShowInfo: ['count', 'percent'],
      seriesCenterLeft: 50,
      seriesCenterTop: 50,
      seriesLineStyleWidth: 2,
      seriesSymbolRotate: 4,
    },
    //自定义配色
    color: {
      AxisTextStyleColor: '', //X、Y轴字体的颜色全局设置
      AxisLineStyleColor: '', //X、Y轴轴线颜色全局设置
      list: [],
    },
    xAxis: {
      type: 'category', //X轴类型[category,value]
      show: true, //X轴是否显示
      data: ['衬衫', '羊毛衫', '雪纺衫', '裤子', '高跟鞋', '袜子'],
      inverse: false, //X轴反转
      name: '', //X轴名称
      nameTextStyle: {
        color: '#303133', //X轴名称字体颜色
        fontSize: 14, //X轴名称字体大小
        fontWeight: '', //X轴名称是否加粗
      },
      axisLine: {
        show: true,
        lineStyle: {
          color: '#303133', //X轴线颜色
        },
      },
      axisLabel: {
        rotate: 0, //X轴标签角度
        color: '#303133', //X轴标签字体颜色
        fontSize: 14, //X轴标签字体大小
        fontWeight: '', //X轴标签是否加粗
      },
      splitLine: {
        show: false, //X轴网格线
        lineStyle: {
          color: '#DFDFDF', //X轴网格线颜色
        },
      },
      axisTick: { alignWithLabel: false }, //刻度对齐
    },
    yAxis: {
      show: true, //y轴是否显示
      inverse: false, //y轴反转
      name: '', //y轴名称
      nameTextStyle: {
        color: '#303133', //y轴名称字体颜色
        fontSize: 14, //y轴名称字体大小
        fontWeight: '', //y轴名称是否加粗
      },
      axisLine: {
        show: true,
        lineStyle: {
          color: '#303133', //y轴线颜色
        },
      },
      axisLabel: {
        rotate: 0, //y轴标签角度
        color: '#303133', //y轴标签字体颜色
        fontSize: 14, //y轴标签字体大小
        fontWeight: '', //y轴标签是否加粗
      },
      splitLine: {
        show: false, //y轴网格线
        lineStyle: {
          color: '#DFDFDF', //y轴网格线颜色
        },
      },
    },
    series: [
      {
        name: '销量',
        type: 'bar',
        data: [5, 20, 36, 10, 10, 20],
      },
    ],
  },
  line: {
    classifyNameField: undefined,
    seriesNameField: undefined,
    seriesDataField: undefined,
    summaryType: 'none',
    chartType: 'line',
    animation: false,
    styleType: 1, //风格类型.
    areaStyle: false, //面积堆积
    //标题设置
    title: {
      text: '折线图示例',
      show: true,
      left: 'center',
      textStyle: { fontSize: 18, fontWeight: 'normal', color: '#333' },
      showSub: true,
      subtext: '子标题',
      subtextStyle: {
        fontSize: 12,
        fontWeight: 'normal',
        color: '#aaa',
      },
    },
    //坐标轴边距设置
    grid: {
      left: 30,
      top: 60,
      right: 10,
      bottom: 50,
    },
    //提示语设置
    tooltip: {
      show: true,
      backgroundColor: '#fff',
      textStyle: {
        color: '#303133',
        fontSize: 14,
        fontWeight: '',
      },
    },
    //图例设置
    legend: {
      show: true,
      textStyle: {
        fontSize: 14,
      },
      fontSize: 14,
      orient: 'horizontal',
      top: 'bottom',
    },
    label: {
      show: false, //显示数值
      fontSize: 14, //数值大小
      fontWeight: '', //数值加粗
      color: '#303133', //数值颜色
      backgroundColor: '', //数值背景色
    },
    //自定义配色
    color: {
      AxisTextStyleColor: '', //X、Y轴字体的颜色全局设置
      AxisLineStyleColor: '', //X、Y轴轴线颜色全局设置
      list: [],
    },
    xAxis: {
      type: 'category', //X轴类型[category,value]
      show: true, //X轴是否显示
      data: ['衬衫', '羊毛衫', '雪纺衫', '裤子', '高跟鞋', '袜子'],
      inverse: false, //X轴反转
      name: '', //X轴名称
      nameTextStyle: {
        color: '#303133', //X轴名称字体颜色
        fontSize: 14, //X轴名称字体大小
        fontWeight: '', //X轴名称是否加粗
      },
      axisLine: {
        show: true,
        lineStyle: {
          color: '#303133', //X轴线颜色
        },
      },
      axisLabel: {
        rotate: 0, //X轴标签角度
        color: '#303133', //X轴标签字体颜色
        fontSize: 14, //X轴标签字体大小
        fontWeight: '', //X轴标签是否加粗
      },
      splitLine: {
        show: false, //X轴网格线
        lineStyle: {
          color: '#DFDFDF', //X轴网格线颜色
        },
      },
      axisTick: { alignWithLabel: false }, //刻度对齐
    },
    yAxis: {
      show: true, //y轴是否显示
      inverse: false, //y轴反转
      name: '', //y轴名称
      nameTextStyle: {
        color: '#303133', //y轴名称字体颜色
        fontSize: 14, //y轴名称字体大小
        fontWeight: '', //y轴名称是否加粗
      },
      axisLine: {
        show: true,
        lineStyle: {
          color: '#303133', //y轴线颜色
        },
      },
      axisLabel: {
        rotate: 0, //y轴标签角度
        color: '#303133', //y轴标签字体颜色
        fontSize: 14, //y轴标签字体大小
        fontWeight: '', //y轴标签是否加粗
      },
      splitLine: {
        show: false, //y轴网格线
        lineStyle: {
          color: '#DFDFDF', //y轴网格线颜色
        },
      },
    },
    series: [
      {
        name: '销量',
        type: 'line',
        data: [5, 20, 36, 10, 10, 20],
      },
    ],
    line: {
      smooth: false,
      symbolSize: 4, //点的大小
    },
    lineStyle: {
      Width: 2, //线条宽度
    },
  },
  pie: {
    classifyNameField: undefined,
    seriesNameField: undefined,
    seriesDataField: undefined,
    summaryType: 'none',
    chartType: 'pie',
    pie: { roseType: false },
    seriesCenter: {
      seriesCenterLeft: 50,
      seriesCenterTop: 50,
    },
    animation: false,
    //标题设置
    title: {
      text: '饼图示例',
      show: true,
      left: 'center',
      textStyle: { fontSize: 18, fontWeight: 'normal', color: '#333' },
      showSub: true,
      subtext: '子标题',
      subtextStyle: {
        fontSize: 12,
        fontWeight: 'normal',
        color: '#aaa',
      },
    },
    tooltip: {
      show: true,
      backgroundColor: '#fff',
      textStyle: {
        color: '#303133',
        fontSize: 14,
        fontWeight: '',
      },
    },
    //图例设置
    legend: {
      show: true,
      textStyle: {
        fontSize: 14,
      },
      fontSize: 14,
      orient: 'horizontal',
      top: 'bottom',
    },
    series: [
      {
        name: '衣物',
        type: 'pie',
        radius: '50%',
        data: [
          { value: 5, name: '衬衫' },
          { value: 20, name: '羊毛衫' },
          { value: 36, name: '雪纺衫' },
          { value: 10, name: '裤子' },
          { value: 10, name: '高跟鞋' },
          { value: 20, name: '袜子' },
        ],
        emphasis: {
          itemStyle: {
            shadowBlur: 10,
            shadowOffsetX: 0,
            shadowColor: 'rgba(0, 0, 0, 0.5)',
          },
        },
      },
    ],
  },
  radar: {
    title: {
      text: '雷达图示例',
    },
    animation: false,
    radar: {
      indicator: [
        { name: '销售', max: 6500 },
        { name: '行政管理', max: 16000 },
        { name: '信息技术', max: 30000 },
        { name: '客户支持', max: 38000 },
        { name: '开发', max: 52000 },
        { name: '市场营销', max: 25000 },
      ],
    },
    series: [
      {
        name: '预算',
        type: 'radar',
        data: [
          {
            value: [4200, 3000, 20000, 35000, 50000, 18000],
            name: '分配预算',
          },
        ],
      },
    ],
  },
};

export enum JnpfPrintPageInfo {
  PageSize = 'PageSize',
  WorkbookTitle = 'WorkbookTitle',
  WorksheetTitle = 'WorksheetTitle',
  Date = 'Date',
  Time = 'Time',
}

export enum JnpfPrintArea {
  CurrentSheet = 'CurrentSheet',
  workbook = 'workbook',
  CurrentSelection = 'CurrentSelection',
}
export const JnpfPrintAreaOptions = [{ id: JnpfPrintArea.CurrentSheet, fullName: '当前工作表' }];

export enum JnpfPaperType {
  Letter = 'Letter',
  Tabloid = 'Tabloid',
  Legal = 'Legal',
  Statement = 'Statement',
  Executive = 'Executive',
  Folio = 'Folio',
  A3 = 'A3',
  A4 = 'A4',
  A5 = 'A5',
  B4 = 'B4',
  B5 = 'B5',
}
export const JnpfPaperTypeOptions = [
  {
    id: JnpfPaperType.A3,
    fullName: 'A3',
  },
  {
    id: JnpfPaperType.A4,
    fullName: 'A4',
  },
  {
    id: JnpfPaperType.A5,
    fullName: 'A5',
  },
  {
    id: JnpfPaperType.B4,
    fullName: 'B4',
  },
  {
    id: JnpfPaperType.B5,
    fullName: 'B5',
  },
  {
    id: JnpfPaperType.Letter,
    fullName: '信纸',
  },
  {
    id: JnpfPaperType.Executive,
    fullName: 'Executive',
  },
  {
    id: JnpfPaperType.Statement,
    fullName: 'Statement',
  },
];

export enum JnpfPaperRotation {
  Portrait = 'Portrait',
  Landscape = 'Landscape',
}
export const JnpfPrintDirectionOptions = [
  {
    id: JnpfPaperRotation.Portrait,
    fullName: '纵向',
  },
  {
    id: JnpfPaperRotation.Landscape,
    fullName: '横向',
  },
];

export enum JnpfPaperScale {
  Origin = 'Origin',
  FitWidth = 'FitWidth',
  FitHeight = 'FitHeight',
  FitPage = 'FitPage',
  Custom = 'Custom',
}
export const JnpfPrintScaleOptions = [
  {
    id: JnpfPaperScale.Origin,
    fullName: '常规',
  },
  {
    id: JnpfPaperScale.FitWidth,
    fullName: '宽度自适应',
  },
  {
    id: JnpfPaperScale.FitHeight,
    fullName: '高度自适应',
  },
  {
    id: JnpfPaperScale.FitPage,
    fullName: '内容自适应',
  },
];

export enum JnpfPaperAlign {
  Start = 'Start',
  End = 'End',
  Middle = 'Middle',
}

export const JnpfPrintHAlignOptions = [
  {
    id: JnpfPaperAlign.Start,
    fullName: '左对齐',
  },
  {
    id: JnpfPaperAlign.Middle,
    fullName: '居中对齐',
  },
  {
    id: JnpfPaperAlign.End,
    fullName: '右对齐',
  },
];

export const JnpfPrintVAlignOptions = [
  {
    id: JnpfPaperAlign.Start,
    fullName: '顶部对齐',
  },
  {
    id: JnpfPaperAlign.Middle,
    fullName: '居中对齐',
  },
  {
    id: JnpfPaperAlign.End,
    fullName: '底部对齐',
  },
];

export enum JnpfPrintFreeze {
  Row = 'Row',
  Column = 'Column',
}

export enum JnpfPaperMarginType {
  Normal = 'Normal',
  Narrow = 'Narrow',
  Wide = 'Wide',
}

export const JnpfPaperSize = {
  [JnpfPaperType.A3]: { w: 1123, h: 1587 },
  [JnpfPaperType.A4]: { w: 794, h: 1124 },
  [JnpfPaperType.A5]: { w: 559, h: 794 },
  [JnpfPaperType.B4]: { w: 944, h: 1344 },
  [JnpfPaperType.B5]: { w: 665, h: 944 },
  [JnpfPaperType.Executive]: { w: 696, h: 1008 },
  [JnpfPaperType.Folio]: { w: 816, h: 1248 },
  [JnpfPaperType.Legal]: { w: 816, h: 1344 },
  [JnpfPaperType.Letter]: { w: 816, h: 1056 },
  [JnpfPaperType.Statement]: { w: 528, h: 816 },
  [JnpfPaperType.Tabloid]: { w: 1056, h: 1632 },
};
export const JnpfPaperMargin = {
  [JnpfPaperMarginType.Normal]: { left: 53, right: 53, top: 56, bottom: 56 },
  [JnpfPaperMarginType.Narrow]: { left: 19, right: 19, top: 56, bottom: 56 },
  [JnpfPaperMarginType.Wide]: { left: 75, right: 75, top: 75, bottom: 75 },
};

// 打印默认的配置
export const DefaultPrintConfig = {
  area: JnpfPrintArea.CurrentSheet,
  paperSize: JnpfPaperType.A4,
  direction: JnpfPaperRotation.Portrait,
  scale: JnpfPaperScale.Origin,
  hAlign: JnpfPaperAlign.Middle,
  vAlign: JnpfPaperAlign.Start,
  gridlines: false,
  PageSize: false,
  WorkbookTitle: false,
  WorkbookTitleText: '',
  WorksheetTitle: false,
  Date: false,
  Time: false,
};
